<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <meta name="google-site-verification" content="k9iQUbEI9rWq3xYeh63ATztKdkthC4dNRHV_25maJ3Q" />
  <title>shell脚本由点到面学习总结 | Taylor&#39;s Learning Diary</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="以前只是零零散散写过一些简单的命令行，比如awk、sed、nc、ls、comm这些简单的命令，几乎没有写过一个完整的shell脚本，像循环、条件判断、数据库操作等几乎都没怎么写过，总觉得shell写起来太麻烦，要学习的东西太多了，其实主要是懒。这次由于业务需要，使用shell脚本能方便解决问题，便硬着头皮上了，借着这个机会把常用的命令整理一下，算作温习吧。 实现功能：将下面未经处理的原始数据，批量">
<meta name="keywords" content="linux,shell">
<meta property="og:type" content="article">
<meta property="og:title" content="shell脚本由点到面学习总结">
<meta property="og:url" content="https://upeng.github.io/blog/2017/09/27/shell-script-learning/index.html">
<meta property="og:site_name" content="Taylor&#39;s Learning Diary">
<meta property="og:description" content="以前只是零零散散写过一些简单的命令行，比如awk、sed、nc、ls、comm这些简单的命令，几乎没有写过一个完整的shell脚本，像循环、条件判断、数据库操作等几乎都没怎么写过，总觉得shell写起来太麻烦，要学习的东西太多了，其实主要是懒。这次由于业务需要，使用shell脚本能方便解决问题，便硬着头皮上了，借着这个机会把常用的命令整理一下，算作温习吧。 实现功能：将下面未经处理的原始数据，批量">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2017-09-27T15:57:33.414Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="shell脚本由点到面学习总结">
<meta name="twitter:description" content="以前只是零零散散写过一些简单的命令行，比如awk、sed、nc、ls、comm这些简单的命令，几乎没有写过一个完整的shell脚本，像循环、条件判断、数据库操作等几乎都没怎么写过，总觉得shell写起来太麻烦，要学习的东西太多了，其实主要是懒。这次由于业务需要，使用shell脚本能方便解决问题，便硬着头皮上了，借着这个机会把常用的命令整理一下，算作温习吧。 实现功能：将下面未经处理的原始数据，批量">
  
    <link rel="alternate" href="/atom.xml" title="Taylor&#39;s Learning Diary" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/blog/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/blog/" id="logo">Taylor&#39;s Learning Diary</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/blog/">Home</a>
        
          <a class="main-nav-link" href="/blog/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://upeng.github.io/blog"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-shell-script-learning" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/blog/2017/09/27/shell-script-learning/" class="article-date">
  <time datetime="2017-09-27T14:38:00.000Z" itemprop="datePublished">2017-09-27</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/blog/categories/Linux/">Linux</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      shell脚本由点到面学习总结
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>以前只是零零散散写过一些简单的命令行，比如awk、sed、nc、ls、comm这些简单的命令，几乎没有写过一个完整的shell脚本，像循环、条件判断、数据库操作等几乎都没怎么写过，总觉得shell写起来太麻烦，要学习的东西太多了，其实主要是懒。这次由于业务需要，使用shell脚本能方便解决问题，便硬着头皮上了，借着这个机会把常用的命令整理一下，算作温习吧。</p>
<h2 id="实现功能："><a href="#实现功能：" class="headerlink" title="实现功能："></a>实现功能：</h2><p>将下面未经处理的原始数据，批量导入到es，并记录导入的数据源；<br><figure class="highlight basic"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="symbol">20170101 </span>       ABCD-EF-G001-<span class="number">12345678</span>    <span class="number">1</span>rt2xete3   CD      <span class="number">1.1977199809152</span></div><div class="line"><span class="symbol">20170101 </span>       ABCD-EF-G001-<span class="number">12345678</span>    <span class="number">1</span>rt2xete4   CD      <span class="number">5.856237342947999</span></div><div class="line"><span class="symbol">20170101 </span>       ABCD-EF-G001-<span class="number">12345678</span>    <span class="number">1</span>rt2xete5   CD      <span class="number">5.1901199172992</span></div><div class="line"><span class="symbol">20170101 </span>       ABCD-EF-G001-<span class="number">12345678</span>    <span class="number">1</span>rt2xete6   CD      <span class="number">0.748574988072</span></div><div class="line"><span class="symbol">20170101 </span>       ABCD-EF-G001-<span class="number">12345678</span>    <span class="number">1</span>rt2xete7   CD      <span class="number">2.4472449769392</span></div><div class="line"><span class="symbol">20170101 </span>       ABCD-EF-G001-<span class="number">12345678</span>    <span class="number">1</span>rt2xete8   CD      <span class="number">9.62620145261278</span></div><div class="line"><span class="symbol">20170101 </span>       ABCD-EF-G001-<span class="number">12345678</span>    <span class="number">1</span>rt2xete9   CD      <span class="number">0.1249524996024</span></div></pre></td></tr></table></figure></p>
<a id="more"></a>
<h2 id="问题说明："><a href="#问题说明：" class="headerlink" title="问题说明："></a>问题说明：</h2><ul>
<li>数据量很大，从1月1号到9月20号，每天一个文件，每个文件大概100w行（约100M），导入es通过http请求，虽然es支持批量bulk导入，但是批量数据大小是有限度的，超过大小直接kill掉</li>
</ul>
<h2 id="要求"><a href="#要求" class="headerlink" title="要求"></a>要求</h2><ul>
<li>导入到es的数据源需要完整记录备份，作为日志，如果导入失败可以补录。</li>
<li>虽然数据源每天一个文件堆在一起，但是日志却不能每个文件都放在一个文件夹里，所以需要设计成按年月（如201701,201702）分为一级文件夹，然后按天（如01,02…30）分为二级文件夹,每个文件夹存储当天的源文件，切割文件等信息</li>
</ul>
<h2 id="步骤"><a href="#步骤" class="headerlink" title="步骤"></a>步骤</h2><p><strong>step1：</strong> 获取日期参数，格式Ymd，如果不传则默认取当天日期</p>
<p><strong>step2：</strong> 根据日期获取源文件（源文件格式<code>年月日.txt</code>）</p>
<p><strong>step3：</strong> 定义输出文件目录格式</p>
<p><strong>step4：</strong> 定义es数据源文件</p>
<p><strong>step5：</strong> 将源文件格式化成es数据原文件，用到sed命令</p>
<p><strong>step6：</strong> 将es数据源文件进行切割，用到split命令</p>
<p><strong>step7：</strong> 获取切割后的文件组成数组</p>
<p><strong>step8：</strong> 循环调用es接口批量入数据</p>
<h2 id="子脚本剖析"><a href="#子脚本剖析" class="headerlink" title="子脚本剖析"></a>子脚本剖析</h2><blockquote>
<p>step1</p>
</blockquote>
<p>1）条件判断 if [condition]; then command1 else command2 fi<br>2）获取命令行参数 $，$0，$1…<br>3）复杂条件判断，多个if else;switch case<br> 详细【待总结】</p>
<p>自定义日期格式<br>如：<code>date &quot;+%Y-%m-%d %H:%M:%S&quot;</code>详细【待总结】 参考：<br> <a href="http://blog.csdn.net/shanliangliuxing/article/details/16821175" target="_blank" rel="external">http://blog.csdn.net/shanliangliuxing/article/details/16821175</a><br> <a href="http://blog.csdn.net/jk110333/article/details/8590746" target="_blank" rel="external">http://blog.csdn.net/jk110333/article/details/8590746</a></p>
<figure class="highlight routeros"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">if</span> [ <span class="variable">$#</span> -eq 0 ]; then </div><div class="line">	<span class="attribute">DATE</span>=`date +%Y%m%d`</div><div class="line"><span class="keyword">else</span></div><div class="line">	<span class="attribute">DATE</span>=<span class="variable">$1</span></div><div class="line">fi</div></pre></td></tr></table></figure>
<blockquote>
<p>step2</p>
</blockquote>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="attr">source_file_path</span>=/data/codes</div><div class="line"><span class="attr">source_file</span>=<span class="variable">$source_file_path</span>/<span class="variable">$DATE</span>.txt</div></pre></td></tr></table></figure>
<blockquote>
<p>step3</p>
</blockquote>
<p>定义年月、日目录名称, 递归创建多层文件目录<br>判断文件或目录是否存在，<code>（-d -f）</code><br>详细【待总结】<br><figure class="highlight routeros"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="attribute">folderYearMonth</span>=`date -d <span class="variable">$DATE</span> +<span class="string">"%Y%m"</span>`</div><div class="line"><span class="attribute">folderDay</span>=`date -d <span class="variable">$DATE</span> +<span class="string">"%d"</span>`</div><div class="line"><span class="attribute">output_file_path</span>=/data/home/upeng/$folderYearMonth/$folderDay</div><div class="line"><span class="keyword">if</span> [ ! -d <span class="string">"<span class="variable">$output_file_path</span>"</span> ]; then</div><div class="line">	mkdir -p <span class="string">"<span class="variable">$output_file_path</span>"</span></div><div class="line">fi</div></pre></td></tr></table></figure></p>
<blockquote>
<p>step4</p>
</blockquote>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="attr">es_source_file</span>=<span class="variable">$output_file_path</span>/<span class="variable">$DATE</span>.json</div><div class="line"><span class="attr">start_at</span>=$(date +%s)  //转换成时间戳</div></pre></td></tr></table></figure>
<blockquote>
<p>step5</p>
</blockquote>
<p><code>sed</code>命令总结；多个<code>sed</code>同时编辑，理解步骤先后顺序，详细【待总结】<br><figure class="highlight cos"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">sed '<span class="keyword">s</span>/\t/,/g<span class="comment">;</span></div><div class="line"><span class="keyword">s</span>/^/&#123;<span class="string">"date"</span>:<span class="string">"&amp;/g;</span></div><div class="line"><span class="string">s/,/"</span>,<span class="string">"code"</span>:<span class="string">"/1;</span></div><div class="line"><span class="string">s/,/"</span>,<span class="string">"oid"</span>:<span class="string">"/2;</span></div><div class="line"><span class="string">s/,/"</span>,<span class="string">"type"</span>:<span class="string">"/3;</span></div><div class="line"><span class="string">s/,/"</span>,<span class="string">"salary"</span>:<span class="string">"/4;s/$/&amp;"</span>&#125;/g<span class="comment">;</span></div><div class="line"><span class="keyword">s</span>/^/&#123;<span class="string">"index"</span>:&#123;&#125;&#125;\n&amp;/g' <span class="built_in">$source</span>_file &gt; <span class="built_in">$es</span>_source_file</div></pre></td></tr></table></figure></p>
<blockquote>
<p>step6</p>
</blockquote>
<p><code>split</code> 文件切割，详细【待总结】<br><figure class="highlight perl"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">split</span> -l <span class="number">500000</span> $es_source_file $output_file_path/$date_</div></pre></td></tr></table></figure></p>
<blockquote>
<p>step7</p>
</blockquote>
<p><code>awk</code>、数组，详细【待总结】<br><figure class="highlight ini"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line"><span class="attr">arrs</span>=($(ls -l <span class="variable">$output_file_path</span>/<span class="variable">$date_</span>* | awk <span class="string">'&#123;print $9&#125;'</span>))</div></pre></td></tr></table></figure></p>
<blockquote>
<p>step8</p>
</blockquote>
<p>循环调用<code>es</code>接口批量入数据，详细【待总结】<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">for</span> arr <span class="keyword">in</span> <span class="variable">$&#123;arrs[@]&#125;</span></div><div class="line"><span class="keyword">do</span></div><div class="line">	curl -XPOST <span class="string">'http://127.0.0.1:9200/media/order/_bulk?pretty'</span> --data-binary @<span class="variable">$arr</span></div><div class="line"><span class="keyword">done</span></div><div class="line"></div><div class="line">end_at=$(date +%s)</div><div class="line"><span class="built_in">echo</span> <span class="string">"it takes <span class="variable">$((end_at-start_at)</span>) seconds"</span></div></pre></td></tr></table></figure></p>
<h2 id="父脚本剖析"><a href="#父脚本剖析" class="headerlink" title="父脚本剖析"></a>父脚本剖析</h2><figure class="highlight stata"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">source_file_path=/data/codes</div><div class="line">script_path=/data/home/upeng</div><div class="line"><span class="keyword">cd</span> <span class="variable">$source_file_path</span></div><div class="line">DATES=($(<span class="keyword">ls</span> -<span class="keyword">l</span> *<span class="string">".txt"</span> | awk '&#123;<span class="keyword">print</span> <span class="variable">$9&#125;</span>' | awk -F '.' '&#123;<span class="keyword">print</span> <span class="variable">$1&#125;</span>'))</div><div class="line"></div><div class="line"><span class="keyword">for</span> date <span class="keyword">in</span> <span class="variable">$&#123;DATES</span>[@]&#125;</div><div class="line"><span class="keyword">do</span></div><div class="line">	folderYm=`date -<span class="keyword">d</span> <span class="variable">$DATES</span> +<span class="string">"%Y%m"</span>`</div><div class="line">	folderD=`date -<span class="keyword">d</span> <span class="variable">$DATES</span> +<span class="string">"%d"</span>`</div><div class="line">	output_file_path=<span class="variable">$script_path</span>/<span class="variable">$folderYm</span>/<span class="variable">$folderD</span></div><div class="line">	<span class="keyword">if</span> [ ! -<span class="keyword">d</span> <span class="string">"$output_file_path"</span> ]; then</div><div class="line">		<span class="keyword">sh</span> <span class="variable">$script_path</span>/child_script.<span class="keyword">sh</span> <span class="variable">$date</span></div><div class="line">		<span class="keyword">cat</span> /dev/null &gt; <span class="variable">$script_path</span>/nohup.<span class="keyword">out</span></div><div class="line">	fi</div><div class="line">done</div></pre></td></tr></table></figure>
<ol>
<li>上述脚本中<code>待总结</code>的部分是每个点需要完善的面</li>
<li>上述脚本还有诸多待完善部分，当前只是能够运行，异常情况如何处理如何捕获待整理</li>
</ol>

      
    </div>
    <footer class="article-footer">
      <a data-url="https://upeng.github.io/blog/2017/09/27/shell-script-learning/" data-id="cj8x781a50041gwp41pmou4sm" class="article-share-link">Share</a>
      
        <a href="https://upeng.github.io/blog/2017/09/27/shell-script-learning/#disqus_thread" class="article-comment-link">留言</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/linux/">linux</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/shell/">shell</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/blog/2017/09/28/linux-sed/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          linux常用命令之sed
        
      </div>
    </a>
  
  
    <a href="/blog/2017/09/14/laravel-eloquent-index/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Eloquent ORM多个and和or条件查询</div>
    </a>
  
</nav>

  
</article>


<section id="comments">
  <div id="disqus_thread">
    <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  </div>
</section>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">分类</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/blog/categories/Linux/">Linux</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/blog/categories/MySQL/">MySQL</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/blog/categories/PHP/">PHP</a><span class="category-list-count">15</span></li><li class="category-list-item"><a class="category-list-link" href="/blog/categories/Thinking/">Thinking</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/blog/categories/其他/">其他</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/blog/categories/前端/">前端</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/blog/categories/数据库范式/">数据库范式</a><span class="category-list-count">1</span></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云</h3>
    <div class="widget tagcloud">
      <a href="/blog/tags/CI/" style="font-size: 10px;">CI</a> <a href="/blog/tags/JQuery/" style="font-size: 10px;">JQuery</a> <a href="/blog/tags/Mac/" style="font-size: 13.33px;">Mac</a> <a href="/blog/tags/MySQL/" style="font-size: 10px;">MySQL</a> <a href="/blog/tags/awk/" style="font-size: 10px;">awk</a> <a href="/blog/tags/bash/" style="font-size: 10px;">bash</a> <a href="/blog/tags/composer/" style="font-size: 10px;">composer</a> <a href="/blog/tags/eloquent/" style="font-size: 10px;">eloquent</a> <a href="/blog/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/blog/tags/idempotence/" style="font-size: 10px;">idempotence</a> <a href="/blog/tags/item/" style="font-size: 10px;">item</a> <a href="/blog/tags/laravel/" style="font-size: 20px;">laravel</a> <a href="/blog/tags/linux/" style="font-size: 16.67px;">linux</a> <a href="/blog/tags/mac/" style="font-size: 10px;">mac</a> <a href="/blog/tags/memcacheq/" style="font-size: 10px;">memcacheq</a> <a href="/blog/tags/mysql/" style="font-size: 16.67px;">mysql</a> <a href="/blog/tags/nc/" style="font-size: 10px;">nc</a> <a href="/blog/tags/packageist/" style="font-size: 10px;">packageist</a> <a href="/blog/tags/php/" style="font-size: 13.33px;">php</a> <a href="/blog/tags/sed/" style="font-size: 10px;">sed</a> <a href="/blog/tags/shell/" style="font-size: 10px;">shell</a> <a href="/blog/tags/static/" style="font-size: 10px;">static</a> <a href="/blog/tags/thinking/" style="font-size: 13.33px;">thinking</a> <a href="/blog/tags/tmux/" style="font-size: 10px;">tmux</a> <a href="/blog/tags/vagrant/" style="font-size: 10px;">vagrant</a> <a href="/blog/tags/validator/" style="font-size: 10px;">validator</a> <a href="/blog/tags/vim/" style="font-size: 10px;">vim</a> <a href="/blog/tags/vuejs/" style="font-size: 10px;">vuejs</a> <a href="/blog/tags/zephir/" style="font-size: 10px;">zephir</a> <a href="/blog/tags/zsh/" style="font-size: 10px;">zsh</a> <a href="/blog/tags/设计模式/" style="font-size: 13.33px;">设计模式</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2017/10/">十月 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2017/09/">九月 2017</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/12/">十二月 2016</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/11/">十一月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/10/">十月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/09/">九月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/08/">八月 2016</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/07/">七月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/06/">六月 2016</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/05/">五月 2016</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/04/">四月 2016</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/02/">二月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2016/01/">一月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2015/10/">十月 2015</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2015/08/">八月 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/blog/archives/2015/07/">七月 2015</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/blog/2017/10/18/laravel-validator/">Laravel Validator自定义参数验证规则</a>
          </li>
        
          <li>
            <a href="/blog/2017/09/28/linux-sed/">linux常用命令之sed</a>
          </li>
        
          <li>
            <a href="/blog/2017/09/27/shell-script-learning/">shell脚本由点到面学习总结</a>
          </li>
        
          <li>
            <a href="/blog/2017/09/14/laravel-eloquent-index/">Eloquent ORM多个and和or条件查询</a>
          </li>
        
          <li>
            <a href="/blog/2017/09/10/Linux压缩解压缩命令-index/">Linux常用压缩解压缩命令</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2017 Tayloryu<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/blog/" class="mobile-nav-link">Home</a>
  
    <a href="/blog/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    
<script>
  var disqus_shortname = 'tayloryu';
  
  var disqus_url = 'https://upeng.github.io/blog/2017/09/27/shell-script-learning/';
  
  (function(){
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>


<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/blog/fancybox/jquery.fancybox.css">
  <script src="/blog/fancybox/jquery.fancybox.pack.js"></script>


<script src="/blog/js/script.js"></script>
  </div>
</body>
</html>